package com.liulin.system.controller;

import com.liulin.system.entity.Healthform;
import com.liulin.system.service.HealthformService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (Healthform)表控制层
 *
 * @author makejava
 * @since 2021-06-22 19:16:13
 */
@RestController
@RequestMapping("healthform")
@CrossOrigin
public class HealthformController {
    /**
     * 服务对象
     */
    @Resource
    private HealthformService healthformService;

    /**
     * 通过主键查询单条数据
     *
     * @param hno 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Healthform selectOne(Integer hno) {
        return this.healthformService.queryById(hno);
    }

    @GetMapping("/addOne")
    public Healthform addOne(Integer sno,Integer height,Integer weight,Integer chest){
        Healthform healthform=new Healthform();
        healthform.setChest(chest);
        healthform.setHeight(height);
        //healthform.setHno(hno);
        healthform.setSno(sno);
        healthform.setWeight(weight);
        return this.healthformService.insert(healthform);
    }

    @GetMapping("/updateOne")
    public Healthform updateOne(Integer hno,Integer sno,Integer height,Integer weight,Integer chest){
        Healthform healthform=new Healthform();
        healthform.setChest(chest);
        healthform.setHeight(height);
        healthform.setHno(hno);
        healthform.setSno(sno);
        healthform.setWeight(weight);
        return this.healthformService.update(healthform);

    }

    @GetMapping("/deleteOne")
    public Boolean deleteOne(Integer hno){
        return this.healthformService.deleteById(hno);
    }

}
